package org.smr.ministore.micro.client;

import java.util.List;
import java.util.Map;

import org.blade.utils.Pager;
import org.smr.ministore.entities.Dictionary;
import org.smr.ministore.entities.DictionaryGroupQueryVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient("Dictionary.Service")
public interface FeignDictionaryMicroServiceClient {

    @RequestMapping(method = RequestMethod.POST, value = "/Dictionary/batchSave")
    int batchSave(@RequestBody List<Dictionary> entities);

    @RequestMapping(method = RequestMethod.PUT, value = "/Dictionary/save")
    public int save(@RequestBody Dictionary entity);

    @RequestMapping(method = RequestMethod.PUT, value = "/Dictionary/updateById")
    public int updateById(@RequestBody Dictionary id);

    @RequestMapping(method = RequestMethod.GET, value = "/Dictionary/queryById/{id}")
    public Dictionary queryById(@PathVariable("id") Long id);

    @RequestMapping(method = RequestMethod.DELETE, value = "/Dictionary/deleteById/{id}")
    public int deleteById(@PathVariable("id") Long id);

    @RequestMapping(method = RequestMethod.POST, value = "/Dictionary/paginate/{pageSize}/{pageNum}")
    public Pager<Dictionary> paginate(@RequestBody Dictionary entity,
                                      @PathVariable("pageSize") Long pageSize,
                                      @PathVariable("pageNum") Long pageNum);

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/Dictionary/getDictionaryGroup")
    public List<Dictionary> getDictionaryGroup(@RequestBody DictionaryGroupQueryVO query);

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/Dictionary/getDictionaryGroup/{sys}/{bigType}/{organId}/{organPath}")
    public List<Dictionary> getDictionaryGroup(@PathVariable("sys") int sys,
                                               @PathVariable("bigType") String bigType,
                                               @PathVariable("organId") Long organId,
                                               @PathVariable("organPath") String organPath);

    /**
     * 获取已引用的字典
     *
     * @param params
     * @return
     */

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/Dictionary/getReferencedDictionaryList")
    public List<Map<String, Object>> getReferencedDictionaryList(@RequestBody Map<String, Object> params);


    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/Dictionary/getOrganReferencedDictionaryPagination/{pageSize}/{pageNum}")
    Pager<Dictionary> getOrganReferencedDictionaryPagination(@RequestBody Dictionary entity, @PathVariable("pageSize") Long pageSize, @PathVariable("pageNum") Long pageNum);


    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/Dictionary/getOrganReferencedDictionaryPagination")
    List<Dictionary> getOrganReferencedDictionary(Dictionary entity);
}
